#ifndef _CSPACESTATIONSTATE_H_
#define _CSPACESTATIONSTATE_H_

#include "IGameState.h"
#include "CGame.h"
#include "Game Objects/CCamera.h"
#include "CMap.h"

class CBaseMessage;
class CNode;

#define NUM_XML_FILES 10

struct nodeplaceholders
{
	std::string filename;
	int numteles;
};



class CSpaceStationState : public IGameState
{
private:
	CSGP_MessageSystem* m_pMS;
	CSGP_EventSystem* m_pES;

	CSpaceStationState(void);
	CSpaceStationState(const CSpaceStationState&);
	CSpaceStationState& operator=(const CSpaceStationState&);
	~CSpaceStationState(void);

	// Pointer to the singletons
	CSGD_TextureManager*				m_pTM;
	CSGD_Direct3D*						m_pD3D;

	// Asset IDs
	int m_nBackgroundID;
	int m_nMusicID;
	int m_nLoadingID;

	int enterposx;
	int enterposy;

	// Pointer to the player
	CPlayer* m_pPlayer;

	// Camera object
	CCamera* m_pCamera;

	// RECTs to enter the level
	RECT m_rLevelOne;

	// How much is loaded
	int m_nPercentLoaded;

	// Map object
	CMap map;
	CMap finalmap;
	void Loadmap(const int numnodes); // minimum 4 nodes maximum 8 mabye...
	void initnodes();

	
	std::vector<nodeplaceholders> tele3;
	std::vector<nodeplaceholders> tele4;
	std::vector<nodeplaceholders> tele2;


	//if true in spacestation, if false in cyberspace
	bool currentstate;

	// Is the state loading
	bool m_bIsLoading;

	//int animationID;
	int DownAnimationID;
	int UpAnimationID;
	int LeftAnimationID;
	int RightAnimationID;

	bool Movingup, Movingdown, Movingleft, Movingright;
	

public:
	static CSpaceStationState* GetInstance(void);


	bool iswon;

	void Enter(void);

	// Display loading screen
	void DisplayLoading(void);

	bool Input(void);
	void Update(float fElapsedTime);
	void Render(void);
	void Exit(void);

	///////////////////////////////////
	// Which levels are completed
	bool m_bOfficeComplete;
	bool m_bSecurityComplete;
	bool m_bSnackComplete;
	bool m_bSecondaryComplete;
	bool m_bMainComplete;
	bool m_bPodComplete;
	bool m_bWonTheGame;
	//////////////////////////////////

	static void MessageProcess(CBaseMessage* pMsg);

	/////////////////////////////////////////////////////
	//	Function	:	Accessors
	//	Purpose		:	To get the specified type.
	/////////////////////////////////////////////////////
	CNode* getnode();

	/////////////////////////////////////////////////////
	//	Function	:	Modifiers
	//	Purpose		:	To set the specified type.
	/////////////////////////////////////////////////////
	bool getstate(){return currentstate;}

	int getentx(){return enterposx;}
	int getenty(){return enterposy;}
	bool GetLoading() { return m_bIsLoading; }
};

#endif